import i18n from "@/lang";

/** @var string 待确认 货件单创建尚未确认是否处理 */
export const WAIT_CONFIRM = 'wait_confirm';

/** @var string 待头程仓库接收（待国内接收） */
export const WAIT_FL_RECEIVE = 'wait_fl_receive';

/** @var string 待装柜 */
export const WAIT_MAKE_CABINET = 'wait_make_cabinet';

/** @var string 待报关  */
export const WAIT_CUSTOMS_DECLARATION = 'wait_customs_declaration';

/** @var string 待装货 */
export const WAIT_SHIPMENT = 'wait_shipment';

/** @var string 待清关 */
export const WAIT_CUSTOMS_CLEARANCE = 'wait_customs_clearance';

/** @var string 待海外接收 */
export const WAIT_RECEIVE = 'wait_receive';

/** @var string 待分拣 */
export const WAIT_SORTING = 'wait_sorting';

/** @var string 已分拣 */
export const FINISHED_SORTING = 'finished_sorting';

/** @var string 线下配送已交付 */
export const OFFLINE_DELIVERED = 'offline_delivered';

/** @var string 部分上架 */
export const HALF_SHELVES = 'half_shelves';

/** @var string 已上架 */
export const FINISHED_SHELVES = 'finished_shelves';

/** @var string 已送仓 （官方仓） */
export const OFFICIAL_DELIVERED = 'official_delivered';

/** @var string 已作废 */
export const ABOLISHED = 'abolished';

/** @var string 买单报关 */
export const BG_BUY_ORDER = 'bg_buy_order';

/** @var string 单证报关 */
export const BG_DOC = 'bg_document';

/** @var string 合并单证报关 */
export const BG_MERGE_DOC = 'bg_merge_document';

export function getShipmentTypeStr(type, subType, accountType = ''){
  if(type === 1 || type === 7){
    return i18n.t('shipment.mercadoFull')
  }
  switch (subType){
    case 1:
      return i18n.t('shipment.oneStock')
    case 2:
      return i18n.t('shipment.middleWarehouse')
    case 3:
      return i18n.t('shipment.小包库存')
  }
  return ''
}

/**
 * 货件状态
 * @param status
 * @returns {VueI18n.TranslateResult}
 */
export function getShipmentStatusStr(status){
  switch (status){
    case -1:
      return i18n.t('shipment.已保存')
    case 0:
      return i18n.t('shipment.待确认')
    case 1:
      return i18n.t('shipment.已确认')
  }
}

export function getShipmentStatus2Str(status){
  const obj = {
    [WAIT_CONFIRM]: '已保存',
    [WAIT_FL_RECEIVE]: '待国内接收',
    [WAIT_MAKE_CABINET]: '待装柜',
    [WAIT_CUSTOMS_DECLARATION]: '待报关',
    [WAIT_SHIPMENT]: '待装货',
    [WAIT_CUSTOMS_CLEARANCE]: '待清关',
    [WAIT_RECEIVE]: '待海外接收',
    [WAIT_SORTING]: '待分拣',
    [FINISHED_SORTING]: '已分拣',
    [HALF_SHELVES]: '部分上架',
    [FINISHED_SHELVES]: '已上架',
    [OFFICIAL_DELIVERED]: '已送仓',
    [ABOLISHED]: '已作废',
    [OFFLINE_DELIVERED]: '已交付',
  }
  return obj[status] || '';
}

/**
 *
 * @param shipmentType
 * @returns {*|string}
 */
export function getShipmentTypeStr2(shipmentType){
  const obj = {
    one_shipping: i18n.t('shipment.oneStock'),
    middle: '暂存中转',
    mkd_full: 'ML直送',
    mkd_cbt_full: 'ML直送(CBT)',
    fala_full: 'FA直送',
    offline_delivery: '线下配送',
  }
  return obj[shipmentType] || '-'
}

/**
 * 报关
 * @param method
 * @returns {*|string}
 */
export function getShipmentBGMethodStr(method){
  const obj = {
    [BG_BUY_ORDER]: '买单报关',
    [BG_DOC]: '单证报关',
    [BG_MERGE_DOC]: '合并单证报关',
  }
  return obj[method] || '';
}

export function getMakeContainerTypeStr(type){
  const obj = {
    1: '物流商装柜',
    2: '自行装柜',
  }
  return obj[type] || ''
}

